package com.young.springdemo.service.flyweigh;

import java.util.HashSet;
import java.util.Hashtable;

//工厂类
public class IgoFactory {
    private  static  IgoFactory instance = new IgoFactory();
    private static Hashtable hs;

    public IgoFactory getInstance() {
        return instance;
    }

    public  IgoFactory() {
        hs = new Hashtable();
        IgoChessman wIgochessman,bIgochessman;
        wIgochessman = new WhiteIgoChessman();
        bIgochessman = new BlackIgoChessman();
        hs.put("b",bIgochessman);
        hs.put("w",wIgochessman);
    }
    public static IgoChessman getIgoChessman(String color){
        return (IgoChessman)hs.get(color);
    }
}
